package com.zycfc.zsf.boot.swagger2;

import org.springframework.boot.autoconfigure.condition.*;
import springfox.documentation.spring.web.*;
import org.springframework.web.servlet.config.annotation.*;

@ConditionalOnClass({ SpringfoxWebMvcConfiguration.class })
public class SwaggerBootstrapConfig implements WebMvcConfigurer
{
    public void addResourceHandlers(final ResourceHandlerRegistry registry) {
        registry.addResourceHandler(new String[] { "doc.html" }).addResourceLocations(new String[] { "classpath:/META-INF/resources/" });
        registry.addResourceHandler(new String[] { "/webjars/**" }).addResourceLocations(new String[] { "classpath:/META-INF/resources/webjars/" });
    }
    
    public void addViewControllers(final ViewControllerRegistry registry) {
        registry.addRedirectViewController("/swagger-ui.html", "/doc.html");
        registry.addRedirectViewController("/monitor.html", "/actuator-ui/index.html");
    }
}
